//
//  SPTabBarController.m
//  百度旅游
//
//  Created by 潘天峰 on 16/11/25.
//  Copyright © 2016年 skyPeat. All rights reserved.
//

#import "SPTabBarController.h"
#import "SPNavigationController.h"
#import "SPDiscoverViewController.h"
#import "SPLocalViewController.h"
#import "SPHomeViewController.h"
@interface SPTabBarController ()
@end
@implementation SPTabBarController
-(void)viewDidLoad
{
    [super viewDidLoad];
    self.view.backgroundColor = randomColor
//    0、添加子控制器
    [self addchildViewControllers];
}
-(void)addchildViewControllers
{
    [self viewcontroller:[[SPDiscoverViewController alloc] init] title:@"发现" normalImage:[UIImage imageNamed:@"Default"] selectedImage:[UIImage imageNamed:@"Default"]];
    [self viewcontroller:[[SPLocalViewController alloc] init] title:@"当地" normalImage:[UIImage imageNamed:@"Default"] selectedImage:[UIImage imageNamed:@"Default"]];
    [self viewcontroller:[[SPHomeViewController alloc] init] title:@"我的" normalImage:[UIImage imageNamed:@"Default"] selectedImage:[UIImage imageNamed:@"Default"]];
}
-(void)viewcontroller:(UIViewController *)viewController title:(NSString *)title normalImage:(UIImage *)normalImage selectedImage:(UIImage *)selectedImage
{
    viewController.title = title;
    viewController.tabBarItem.image = normalImage;
    viewController.tabBarItem.selectedImage = selectedImage;
    SPNavigationController *naVC = [[SPNavigationController alloc] initWithRootViewController:viewController];
    [self addChildViewController:naVC];
}
@end
